﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ComputerizedRehabForms
{
    public partial class BLBResultsForm : Form
    {
        public BLBResultsForm()
        {
            InitializeComponent();
        }

        protected override void OnPaint(PaintEventArgs e)
        {
            /*
             * All of the work for the results page is done in this method
             * First, a copy of each line from the Test page is drawn in the same location as the test line
             * Next, a vertical green line is drawn at the midpoint of each line
             * Finally, a red X is drawn at the first 17 spots the mouse was clicked
             */
            base.OnPaint(e);
            Graphics g;
            
            g = e.Graphics;

            Pen myPen = new Pen(Color.Gray);
            myPen.Width = 3;
            /* Draw all of the lines*/
            g.DrawLine(myPen, 300, (3 * BLBTestForm.screen_height) / 40, BLBTestForm.screen_width - 300, (3 * BLBTestForm.screen_height) / 40);
            g.DrawLine(myPen, 0, (5 * BLBTestForm.screen_height) / 40, BLBTestForm.screen_width - 500, (5 * BLBTestForm.screen_height) / 40);
            g.DrawLine(myPen, 750, (7 * BLBTestForm.screen_height) / 40, BLBTestForm.screen_width - 100, (7 * BLBTestForm.screen_height) / 40);
            g.DrawLine(myPen, 400, (9 * BLBTestForm.screen_height) / 40, BLBTestForm.screen_width - 400, (9 * BLBTestForm.screen_height) / 40);
            g.DrawLine(myPen, 25, (11 * BLBTestForm.screen_height) / 40, BLBTestForm.screen_width / 2, (11 * BLBTestForm.screen_height) / 40);
            g.DrawLine(myPen, 350, (13 * BLBTestForm.screen_height) / 40, BLBTestForm.screen_width, (13 * BLBTestForm.screen_height) / 40);
            g.DrawLine(myPen, 300, (15 * BLBTestForm.screen_height) / 40, BLBTestForm.screen_width - 250, (15 * BLBTestForm.screen_height) / 40);
            g.DrawLine(myPen, 50, (17 * BLBTestForm.screen_height) / 40, BLBTestForm.screen_width - 800, (17 * BLBTestForm.screen_height) / 40);
            g.DrawLine(myPen, 200, (19 * BLBTestForm.screen_height) / 40, BLBTestForm.screen_width - 250, (19 * BLBTestForm.screen_height) / 40);
            g.DrawLine(myPen, 450, (21 * BLBTestForm.screen_height) / 40, BLBTestForm.screen_width - 100, (21 * BLBTestForm.screen_height) / 40);
            g.DrawLine(myPen, 300, (23 * BLBTestForm.screen_height) / 40, BLBTestForm.screen_width - 350, (23 * BLBTestForm.screen_height) / 40);
            g.DrawLine(myPen, 0, (25 * BLBTestForm.screen_height) / 40, BLBTestForm.screen_width - 500, (25 * BLBTestForm.screen_height) / 40);
            g.DrawLine(myPen, 650, (27 * BLBTestForm.screen_height) / 40, BLBTestForm.screen_width - 50, (27 * BLBTestForm.screen_height) / 40);
            g.DrawLine(myPen, 200, (29 * BLBTestForm.screen_height) / 40, BLBTestForm.screen_width - 200, (29 * BLBTestForm.screen_height) / 40);
            g.DrawLine(myPen, 150, (31 * BLBTestForm.screen_height) / 40, BLBTestForm.screen_width - 650, (31 * BLBTestForm.screen_height) / 40);
            g.DrawLine(myPen, 600, (33 * BLBTestForm.screen_height) / 40, BLBTestForm.screen_width - 100, (33 * BLBTestForm.screen_height) / 40);
            g.DrawLine(myPen, BLBTestForm.screen_width / 3, (35 * BLBTestForm.screen_height) / 40, 2 * BLBTestForm.screen_width / 3, (35 * BLBTestForm.screen_height) / 40);

            /*Draw all of the midpoint lines, in green*/
            myPen.Color = System.Drawing.Color.Green;
            for (int i = 0; i < 17; i++)
            {
                g.DrawLine(myPen, BLBTestForm.midpoint_x[i], BLBTestForm.midpoint_y[i] +25, BLBTestForm.midpoint_x[i], BLBTestForm.midpoint_y[i] -25);
            }
            
            /*Draw all of the mouse click X's, in red*/
            myPen.Color = System.Drawing.Color.Red;
            for (int i = 0; i < 17; i++ )
            {
                //if the backbutton is hit undo the last click.
                
                    g.DrawLine(myPen, BLBTestForm.mouse_x[i] - 10, BLBTestForm.mouse_y[i] - 10, BLBTestForm.mouse_x[i] + 10, BLBTestForm.mouse_y[i] + 10);
                    g.DrawLine(myPen, BLBTestForm.mouse_x[i] - 10, BLBTestForm.mouse_y[i] + 10, BLBTestForm.mouse_x[i] + 10, BLBTestForm.mouse_y[i] - 10);

                }  

        }

        private void BLBResultsForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            Application.Exit();
        }
        
        private void save_button_Click_1(object sender, EventArgs e)
        {

        }

        private void no_save_button1_Click(object sender, EventArgs e)
        {
            DataManager.showExit();
        }

        private void BLBResultsForm_Load(object sender, EventArgs e)
        {

        }
    }
}
